//
//  StateHeaderView.m
//  WorkNest
//
//  Created by qbm360 on 15/7/31.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "StateHeaderView.h"

@interface StateHeaderView ()

@property (strong, nonatomic) IBOutlet UIView *view;
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *productNumber;
@property (weak, nonatomic) IBOutlet UILabel *orderNumber;
@property (weak, nonatomic) IBOutlet UIView *borderLine;

@end

@implementation StateHeaderView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if(self) {
        [self setup];
    }
    return self;
}

- (void)setup
{
    [[NSBundle mainBundle] loadNibNamed:@"StateHeaderView" owner:self options:nil];
    _view.frame = self.bounds;
    [self addSubview:_view];
    self.borderLine.layer.borderWidth = 1;
    self.borderLine.layer.borderColor = [[UIUtil colorWithHexString:@"#bdbaba"] CGColor];
}

- (void)setModel:(BulkorderModel *)model {
    _model = model;
    self.name.text = _model.productName;
    [self.image setImageWithURL:[NSURL URLWithString:[UIUtil containString:_model.mainImage]] placeholderImage:[UIImage imageNamed:@"tupian"]];
    self.productNumber.text = [NSString stringWithFormat:@"产品款号:%@",_model.productId];
    self.orderNumber.text = [NSString stringWithFormat:@"订单号:%@",_model.bulkOrderId];
}

@end
